#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;

int main(int argc, char const *argv[])
{
    char calc,cl[20],ans[100];
    int n,res,in2,in3;
    scanf("%d",&n);
    while (n--)
    {
        scanf("%s",&cl);
        if (cl[0]=='a')
        {
            scanf("%d %d",&in2,&in3);
            calc='+';
        }else if (cl[0]=='b')
        {
            scanf("%d %d",&in2,&in3);
            calc='-';
        }else if (cl[0]=='c')
        {
            scanf("%d %d",&in2,&in3);
            calc='*';
        }else{
            sscanf(cl,"%d",&in2);
            scanf("%d",&in3);
        }
        switch (calc)
        {
        case '+':
            res=in2+in3;
            break;
        case '-':
            res=in2-in3; 
            break;
        case '*':
            res=in2*in3;
            break;
        default:
            break;
        }
        sprintf(ans,"%d%c%d=%d",in2,calc,in3,res);
        printf("%s\n%d\n",ans,strlen(ans));
    }
    return 0;
}
